//
// Description: 171. Excel 表列序号
// Created by Loading on 2021/7/30.
//

#include <bits/stdc++.h>

using namespace std;

int titleToNumber(string columnTitle) {
    long long base = 1;
    int res = 0;
    for (int i = (int) columnTitle.size() - 1; i >= 0; --i) {
        int x = columnTitle[i] - 'A' + 1;
        res += base * x;
        base *= 26;
    }

    return res;
}

int main() {
    string columnTitle = "FXSHRXW";
    cout << titleToNumber(columnTitle) << endl;
}